﻿
@{
    ViewBag.Title = "PEUserView";
    Layout = "~/Views/Shared/_MyLayout.cshtml";
}
<style>
    .layui-table-cell {
        height: 20px;
        line-height:20px;
    }
</style>
<table lay-filter="demo">
    <thead>
        <tr>
            <th lay-data="{field:'A1',title:'A1', width:130,align:'center'}"></th>
            <th lay-data="{field:'A2',title:'A2', width:100,align:'center'}"></th>
            <th lay-data="{field:'A3',title:'A3', width:150,align:'center'}"></th>
            <th lay-data="{field:'A4',title:'A4', width:150,align:'center'}"></th>
            <th lay-data="{field:'A5',title:'A5', width:150,align:'center'}"></th>
            <th lay-data="{field:'A6',title:'A6', width:150,align:'center'}"></th>
            @*<th lay-data="{field:'A7',title:'A7', width:150,align:'center'}"></th>
            <th lay-data="{field:'A8',title:'A8', width:150,align:'center'}"></th>*@
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>报价测算汇总表</td>
        </tr>
        <tr>
            <td>项目名称</td>
            <td></td>
            <td>用电性质</td>
            <td></td>
            <td>所属区域</td>
            <td></td>
        </tr>
        <tr>
            <td>建筑面积</td>
            <td></td>
            <td>容量(KVA)</td>
            <td></td>
            <td>外线长度</td>
            <td></td>
        </tr>
        <tr>
            <td>红线内报价</td>
            <td></td>
            <td>红线内单方造价</td>
            <td></td>
            <td>红线内容量单价</td>
            <td></td>
        </tr>
        <tr>
            <td>总报价</td>
            <td></td>
            <td>单方造价</td>
            <td></td>
            <td>容量单价</td>
            <td></td>
        </tr>
        <tr>
            <td>楼盘业态</td>
            <td></td>
            <td>公配容量</td>
            <td></td>
            <td>专配容量</td>
            <td></td>
        </tr>
        <tr>
            <td>费用类型</td>
            <td>费用类别</td>
            <td>费用目录</td>
            <td>成本测算</td>
            <td>备注</td>
            <td></td>
        </tr>
        <tr>
            <td>工程直接成本</td>
            <td>外线</td>
            <td>外线土建施工费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>外线设备费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>外线材料费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        @*开闭所*@
        <tr>
            <td>开闭所</td>
            <td>设备费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>材料费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        @*公用*@
        <tr>
            <td>公用</td>
            <td>设备费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>材料费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        @*专用*@
        <tr>

            <td>专用</td>
            <td>设备费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>材料费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        @*总体*@
        <tr>

            <td>总体</td>
            <td>安装施工费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>实验调试费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>运行准备费</td>
            <td>1</td>
            <td></td>
        </tr>
        @*业主要求*@
        <tr>

            <td>业主要求</td>
            <td>土建施工费(红线内)</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>柴发</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>

            <td>一户一表费</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>联络路径</td>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>充电桩</td>
            <td>1</td>
            <td>2</td>
        </tr>
        @*小计*@
        <tr>
            <td>小计</td>
            <td>XXXXX</td>
            <td></td>
        </tr>
        @*工程管理成本 多径合同金额*@
        <tr>
            <td>工程管理成本</td>
            <td>多经合同金额(元)</td>
            <td></td>
        </tr>
        @*工程管理成本*@
        <tr>
            <td>电力局费用</td>
            <td>设计费</td>
        </tr>
        <tr>
            <td>电力局费用</td>
            <td>监理费</td>
        </tr>
        <tr>
            <td>电力局费用</td>
            <td>多径管理费</td>
        </tr>
        <tr>
            <td>公司费用</td>
            <td>税金</td>
        </tr>
        <tr>
            <td>公司费用</td>
            <td>资金成本</td>
        </tr>
        <tr>
            <td>公司费用</td>
            <td>公司管理费</td>
        </tr>
        <tr>
            <td>公司费用</td>
            <td>业务费</td>
        </tr>
        @*合计、利润、报价金额*@
        <tr>
            <td>合计</td>
            <td>XXXXX</td>
        </tr>
        <tr>
            <td>利润</td>
            <td>XXXXX</td>
        </tr>
        <tr>
            <td>报价金额</td>
            <td>XXXXX</td>
        </tr>


    </tbody>
</table>

<script type="text/javascript">
    var PreEstId = parent.$("#PreEstId").val();
    var PreEstType = parent.$("#ProjectType").val();
    var DataMap =  @Html.Raw(Json.Encode(ViewBag.DataMap));
    var table;
    layui.use(['form', 'table', 'upload', 'layer', 'element'], function () {
        var element = layui.element;
        var form = layui.form;
        table = layui.table;
        var tab = parent.tab;
        var layer = layui.layer;

        //转换静态表格
        table.init('demo', {

             limit: 100 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致

            //支持所有基础参数

             ,done: function (res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                //console.log(res);
                ////得到当前页码
                //console.log(curr);
                ////得到数据总量
                //console.log(count);
                tableInit();
            }
        });

        table.on('edit(demo)', function (obj) { //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            //console.log(obj.value); //得到修改后的值
            //console.log(obj.field); //当前编辑的字段名
            //console.log(obj.data); //所在行的所有相关数据

            var temp = obj;
            var RowIndex = obj.tr[0].rowIndex;
            var FieldName, FieldValue;
            switch (RowIndex) {
                case 1:
                    if (obj.field == "A2") {
                        FieldName = "XMMC";
                    }
                    if (obj.field == "A4") {
                        FieldName = "YDXZ";
                    }
                    if (obj.field == "A6") {
                        FieldName = "SSQY";
                    }
                    break;
                case 2:
                    if (obj.field == "A2") {
                        FieldName = "JZMJ";
                    }
                    if (obj.field == "A4") {
                        FieldName = "RL";
                    }
                    if (obj.field == "A6") {
                        FieldName = "WXCD";
                    }
                    break;
                case 3:
                    if (obj.field == "A2") {
                        FieldName = "HXNBJJE";
                    }
                    break;
                case 5: //楼盘业态 公配容量 专配容量
                    if (obj.field == "A2") {
                        FieldName = "LPYT";
                    }
                    if (obj.field == "A4") {
                        FieldName = "GPRL";
                    }
                    if (obj.field == "A6") {
                        FieldName = "ZPRL";
                    }
                    break;
                case 7:
                    if (obj.field == "A5") {
                        FieldName = "Memo_WXTJ";
                    }
                    break;
                case 8:
                    if (obj.field == "A3") {
                        FieldName = "Memo_WXSB";
                    }
                    break;
                case 9:
                    if (obj.field == "A3") {
                        FieldName = "Memo_WXCL";
                    }
                    break;
                case 10:
                    if (obj.field == "A4") {
                        FieldName = "Memo_KBSSB";
                    }
                    break;
                case 11:
                    if (obj.field == "A3") {
                        FieldName = "Memo_KBSCL";
                    }
                    break;
                case 12:
                    if (obj.field == "A4") {
                        FieldName = "Memo_GYSB";
                    }
                    break;
                case 13:
                    if (obj.field == "A3") {
                        FieldName = "Memo_GYCL";
                    }
                    break;
                case 14:
                    if (obj.field == "A4") {
                        FieldName = "Memo_ZYSB";
                    }
                    break;
                case 15:
                    if (obj.field == "A3") {
                        FieldName = "Memo_ZYCL";
                    }
                    break;
                case 16:
                    if (obj.field == "A4") {
                        FieldName = "Memo_ZTAZ";
                    }
                    break;
                case 17:
                    if (obj.field == "A3") {
                        FieldName = "Memo_ZTSYTSF";
                    }
                    break;
                //case 18:
                //    if (obj.field == "A3") {
                //        FieldName = "Memo_ZTTJSGF";
                //    }
                //    break;
                case 19:
                    if (obj.field == "A4") {
                        FieldName = "Memo_ZTTJSGF";
                    }
                    break;
                case 20:
                    if (obj.field == "A2") {
                        FieldName = "YZYQ_CF";
                    }
                    if (obj.field == "A3") {
                        FieldName = "Memo_YZYQCF";
                    }
                    break;
                case 21:
                    if (obj.field == "A2") {
                        FieldName = "YZYQ_YHYB";
                    }
                    if (obj.field == "A3") {
                        FieldName = "Memo_YZYQYHYB";
                    }
                    break;
                case 22:
                    if (obj.field == "A2") {
                        FieldName = "YZYQ_LLLJ";
                    }
                    if (obj.field == "A3") {
                        FieldName = "Memo_YZYQLLLJ";
                    }
                    break;
                case 23:
                    if (obj.field == "A2") {
                        FieldName = "YZYQ_CDZ";
                    }
                    if (obj.field == "A3") {
                        FieldName = "Memo_YZYQCDZ";
                    }
                    break;

                ////////小计
                /////////////////////////////////////////////////////////
                case 25:
                    if (obj.field == "A3") {
                        FieldName = "DJHTJE";
                    }
                    if (obj.field == "A4") {
                        FieldName = "Memo_DJHTJE";
                    }
                    break;
                case 26:
                    if (obj.field == "A4") {
                        FieldName = "SJF";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_SJF";
                    }
                    break;
                case 27:
                    if (obj.field == "A4") {
                        FieldName = "JLF";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_JLF";
                    }
                    break;
                case 28:
                    if (obj.field == "A4") {
                        FieldName = "DJGLF";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_DJGLF";
                    }
                    break;
                case 29:
                    if (obj.field == "A4") {
                        FieldName = "SJ";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_SJ";
                    }
                    break;
                case 30:
                    if (obj.field == "A4") {
                        FieldName = "ZJCB";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_ZJCB";
                    }
                    break;
                case 31:
                    if (obj.field == "A4") {
                        FieldName = "GSGLF";
                    }
                    if (obj.field == "A5") {
                        FieldName = "Memo_GSGLF";
                    }
                    break;
                case 32:
                    if (obj.field == "A4") {
                        FieldName = "Memo_YWF";
                    }
                    break;
                ///利润合计
                //////////////////////
                case 34:
                    if (obj.field == "A3") {
                        FieldName = "LRL";
                    }
                    if (obj.field == "A4") {
                        FieldName = "Memo_LRL";
                    }
                    break;


                
            }

            FieldValue = obj.value;
            UpdateTable(FieldName, FieldValue, PreEstId);

        });


    });

    function UpdateTable(FieldName, FieldValue, PreEstId) {

        $.ajax({
            type: "POST",
            url: "/Estimate/PEUserUpdate",
            async: false,
            data: { "FieldName": FieldName, "FieldValue": FieldValue, "PreEstId": PreEstId, "PreEstType": PreEstType },
            success: function (msg) {
                if (msg.result == "OK") {
                    parent.layer.msg('修改成功，请刷新', { icon: 6, time: 1000 });
                    DataMap = msg;
                    tableInit();
                } else {
                    alert(msg.result);
                }
            }
        });
    }


    function tableInit() {

        var temp1 = $(".layui-table-body tbody").find("tr[data-index='0']");
        //整理第1行元素
        $(temp1).find("td[data-field!='A1']").remove();
        $(temp1).find("td[data-field='A1']").attr("colspan", "8");
        $(temp1).find("td[data-field='A1'] div").removeClass("laytable-cell-1-0-0");
        

        //第2行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='1']");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A6']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.XMMC);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.YDXZ);
        $(temp1).find("td[data-field='A6'] div").text(DataMap.SSQY);

        //第3行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='2']");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A6']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.JZMJ);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.RL);
        $(temp1).find("td[data-field='A6'] div").text(DataMap.WXCD);

        //第4行数据最最后整理

        //第5行数据整理（在最底部）

        //第5行数据整理 楼盘业态，公配容量，专配容量
        temp1 = $(".layui-table-body tbody").find("tr[data-index='5']");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A6']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.LPYT);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.GPRL);
        $(temp1).find("td[data-field='A6'] div").text(DataMap.ZPRL);

        //第6行数据整理  附表头
        temp1 = $(".layui-table-body tbody").find("tr[data-index='6']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").attr("colspan", "2");
        $(temp1).find("td[data-field='A5'] div").removeClass("laytable-cell-1-0-0");

//////////////////////////////////////////////////////////////////////////////////////////
        //工程直接成本 --外线
        //外线
        //第7行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='7']");

        $(temp1).find("td[data-field='A1']").attr("rowspan", "17");
        $(temp1).find("td[data-field='A2']").attr("rowspan", "3");

        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").attr("colspan", "2");
        $(temp1).find("td[data-field='A5'] div").removeClass("laytable-cell-1-0-4");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.CivilPrice_WX);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_WXTJ);
        //$(temp1).find("td[data-field!='A7']").remove();
        //$(temp1).find("td[data-field!='A8']").remove();

        //第8行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='8']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.EquipFee_WX);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_WXSB);

        //第9行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='9']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.MeterialFee_WX);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_WXCL);

        //开闭所
        //第10行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='10']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "2");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4'] div").removeClass("laytable-cell-1-0-3");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.EquipFee_KBS);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_KBSSB);

        //第11行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='11']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.MeterialFee_KBS);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_KBSCL);

        //公用
        //第12行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='12']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "2");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4'] div").removeClass("laytable-cell-1-0-3");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.EquipFee_GP);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_GYSB);



        //第13行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='13']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text((DataMap.MeterialFee_GP).toFixed(2));
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_GYCL);



        //专用
        //第14行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='14']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "2");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4'] div").removeClass("laytable-cell-1-0-3");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.EquipFee_ZP);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_ZYSB);


        //第15行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='15']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.MeterialFee_ZP);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_ZYCL);


        //总体
        //第16行数据整理 安装施工费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='16']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "3");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4'] div").removeClass("laytable-cell-1-0-3");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text((DataMap.InstallFee_WX + DataMap.InstallFee_KBS + DataMap.InstallFee_GP + DataMap.InstallFee_ZP));
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_ZTAZ);

        //第17行数据整理 实验调试费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='17']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.TestFee);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_ZTSYTSF);

        //第18行数据整理 运行准备费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='18']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A1'] div").removeClass("laytable-cell-1-0-0");
        //$(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.MeterialFee_YX);
        //$(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_ZTTJSGF);


        //业主要求
        //第18行数据整理 土建施工费(红线内)
        temp1 = $(".layui-table-body tbody").find("tr[data-index='19']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "5");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        //$(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        //$(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.CivilPrice_HXN);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_ZTTJSGF);

        //第19行数据整理  柴发
        temp1 = $(".layui-table-body tbody").find("tr[data-index='20']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.YZYQ_CF);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_YZYQCF);



        //第20行数据整理 一户一表
        temp1 = $(".layui-table-body tbody").find("tr[data-index='21']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.YZYQ_YHYB);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_YZYQYHYB);

        //第21行数据整理 联络路径
        temp1 = $(".layui-table-body tbody").find("tr[data-index='22']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.YZYQ_LLLJ);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_YZYQLLLJ);


        //第22行数据整理 充电桩
        temp1 = $(".layui-table-body tbody").find("tr[data-index='23']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A2'] div").text(DataMap.YZYQ_CDZ);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.Memo_YZYQCDZ);

        //小计 
        //第23行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='24']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").remove();
        $(temp1).find("td[data-field='A1']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        var XJ = DataMap.YZYQ_CDZ + DataMap.YZYQ_LLLJ + DataMap.YZYQ_YHYB + DataMap.YZYQ_CF + DataMap.TestFee + DataMap.CivilPrice_HXN + DataMap.InstallFee_WX+
            DataMap.InstallFee_KBS + DataMap.InstallFee_GP + DataMap.InstallFee_ZP + DataMap.MeterialFee_ZP + DataMap.EquipFee_ZP +
            DataMap.MeterialFee_GP + DataMap.EquipFee_GP + DataMap.MeterialFee_KBS + DataMap.EquipFee_KBS + DataMap.MeterialFee_WX + DataMap.MeterialFee_YX+
            DataMap.EquipFee_WX + DataMap.CivilPrice_WX;
        $(temp1).find("td[data-field='A2'] div").text(XJ.toFixed(2));
        //$(temp1).find("td[data-field='A3']").attr("data-edit", "text");

        //工程管理成本
        //多经合同金额
        //第24行数据整理
        var tempSum = 0;
        tempSum += XJ;

        //多径合同金额 这里多径合同金额按照公式计算，去除掉原数据库DJHTJE字段 前端内的字符为 DataMap.DJHTJE
        temp1 = $(".layui-table-body tbody").find("tr[data-index='25']");
        $(temp1).find("td[data-field='A1']").attr("rowspan", "8");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A3']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        $(temp1).find("td[data-field='A3'] div").removeClass("laytable-cell-1-0-2");
        $(temp1).find("td[data-field='A4'] div").removeClass("laytable-cell-1-0-3");
        //$(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        //这里多径合同金额按照公式计算，去除掉原数据库DJHTJE字段
        var TempDJHTJE = XJ - DataMap.CivilPrice_WX - DataMap.CivilPrice_HXN  - DataMap.YZYQ_CF - DataMap.YZYQ_YHYB - DataMap.YZYQ_LLLJ - DataMap.YZYQ_CDZ;
        TempDJHTJE = TempDJHTJE * 1.5;
        $(temp1).find("td[data-field='A3'] div").text((TempDJHTJE).toFixed(2));
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_DJHTJE);
        tempSum += 0;
        
        //第25行数据整理 设计费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='26']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.SJF);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_SJF);
        $(temp1).find("td[data-field='A3'] div").text((DataMap.SJF * TempDJHTJE).toFixed(0));
        tempSum += DataMap.SJF * TempDJHTJE;

        //第26行数据整理 监理费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='27']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.JLF);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_JLF);
        $(temp1).find("td[data-field='A3'] div").text((DataMap.JLF * TempDJHTJE).toFixed(0));
        tempSum += DataMap.JLF * TempDJHTJE;

        //第27行数据整理 多径管理费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='28']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.DJGLF);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_DJGLF);
        $(temp1).find("td[data-field='A3'] div").text((DataMap.DJGLF * TempDJHTJE).toFixed(0));
        tempSum += DataMap.DJGLF * TempDJHTJE;

        //第28行数据整理 税金
        temp1 = $(".layui-table-body tbody").find("tr[data-index='29']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.SJ);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_SJ);
        $(temp1).find("td[data-field='A3'] div").text((DataMap.SJ * TempDJHTJE).toFixed(0));
        tempSum += DataMap.SJ * TempDJHTJE;

        //第29行数据整理 资金成本
        temp1 = $(".layui-table-body tbody").find("tr[data-index='30']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.ZJCB);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_ZJCB);
        $(temp1).find("td[data-field='A3'] div").text(DataMap.ZJCB);
        tempSum += DataMap.ZJCB;

        //第30行数据整理 公司管理费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='31']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A5']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4'] div").text(DataMap.GSGLF);
        $(temp1).find("td[data-field='A5'] div").text(DataMap.Memo_GSGLF);
        $(temp1).find("td[data-field='A3'] div").text((DataMap.GSGLF * TempDJHTJE).toFixed(0));
        tempSum += DataMap.GSGLF * TempDJHTJE;

        //第31行数据整理 业务费
        temp1 = $(".layui-table-body tbody").find("tr[data-index='32']");
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A4']").attr("colspan", "2");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.CoordFee);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_YWF);
        tempSum += DataMap.CoordFee;

        //合计、利润、报价金额
        //第32行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='33']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A3']").remove();
        $(temp1).find("td[data-field='A1']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        $(temp1).find("td[data-field='A2'] div").text(tempSum.toFixed(2));

        //第33行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='34']");
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A1']").attr("colspan", "3");
        $(temp1).find("td[data-field='A3']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A4']").attr("data-edit", "text");
        $(temp1).find("td[data-field='A3'] div").text(DataMap.LRL);
        $(temp1).find("td[data-field='A4'] div").text(DataMap.Memo_LRL);
        $(temp1).find("td[data-field='A2'] div").text((DataMap.LRL * tempSum).toFixed(0));

        //第34行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='35']");
        $(temp1).find("td[data-field='A3']").remove();
        $(temp1).find("td[data-field='A4']").remove();
        $(temp1).find("td[data-field='A5']").remove();
        $(temp1).find("td[data-field='A6']").remove();
        $(temp1).find("td[data-field='A1']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2']").attr("colspan", "3");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        $(temp1).find("td[data-field='A2'] div").text((DataMap.LRL * tempSum + tempSum).toFixed(2));
        var SUMMoney = DataMap.LRL * tempSum + tempSum;

        //第5行数据整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='4']");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        $(temp1).find("td[data-field='A2'] div").text(SUMMoney.toFixed(2));
        $(temp1).find("td[data-field='A4'] div").text((SUMMoney / DataMap.JZMJ).toFixed(0));
        $(temp1).find("td[data-field='A6'] div").text((SUMMoney / DataMap.RL).toFixed(0));

        //第4行数据整理  在最后整理
        temp1 = $(".layui-table-body tbody").find("tr[data-index='3']");
        $(temp1).find("td[data-field='A2'] div").removeClass("laytable-cell-1-0-1");
        var a1 = DataMap.EquipFee_KBS + DataMap.MeterialFee_KBS + DataMap.EquipFee_GP + DataMap.MeterialFee_GP + DataMap.EquipFee_ZP + DataMap.MeterialFee_ZP;
        var a2 = DataMap.EquipFee_WX + DataMap.MeterialFee_WX + DataMap.EquipFee_KBS + DataMap.MeterialFee_KBS + DataMap.EquipFee_GP + DataMap.MeterialFee_GP + DataMap.EquipFee_ZP + DataMap.MeterialFee_ZP;
        var a3 = a1 / a2 * SUMMoney;
        $(temp1).find("td[data-field='A2'] div").text(a3.toFixed(2));



        $(temp1).find("td[data-field='A4'] div").text((a3 / DataMap.JZMJ).toFixed(0));
        $(temp1).find("td[data-field='A6'] div").text((a3 / DataMap.RL).toFixed(0));


    }




</script>

